home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / resourceremote.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.0 KB  |  132 lines

  1.  /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef KCAL_RESOURCEREMOTEDIR_H
  22. #define KCAL_RESOURCEREMOTEDIR_H
  23.  
  24. #include <qptrlist.h>
  25. #include <qstring.h>
  26. #include <qdatetime.h>
  27.  
  28. #include <kurl.h>
  29. #include <kconfig.h>
  30. #include <kdirwatch.h>
  31. #include <kdepimmacros.h>
  32.  
  33. #include <libkdepim/progressmanager.h>
  34.  
  35. #include <libkcal/incidence.h>
  36. #include <libkcal/calendarlocal.h>
  37. #include <libkcal/icalformat.h>
  38.  
  39. #include <libkcal/resourcecached.h>
  40.  
  41. namespace KIO {
  42. class FileCopyJob;
  43. class Job;
  44. }
  45.  
  46. namespace KCal {
  47.  
  48. /**
  49.   This class provides a calendar stored as a remote file.
  50. */
  51. class KDE_EXPORT ResourceRemote : public ResourceCached
  52. {
  53.     Q_OBJECT
  54.  
  55.     friend class ResourceRemoteConfig;
  56.  
  57.   public:
  58.     /**
  59.       Create resource from configuration information stored in KConfig object.
  60.     */
  61.     ResourceRemote( const KConfig * );
  62.     /**
  63.       Create remote resource.
  64.       
  65.       @param downloadUrl URL used to download iCalendar file
  66.       @param uploadUrl   URL used to upload iCalendar file
  67.     */
  68.     ResourceRemote( const KURL &downloadUrl, const KURL &uploadUrl = KURL() );
  69.     virtual ~ResourceRemote();
  70.  
  71.     void readConfig( const KConfig *config );
  72.     void writeConfig( KConfig *config );
  73.  
  74.     void setDownloadUrl( const KURL & );
  75.     KURL downloadUrl() const;
  76.  
  77.     void setUploadUrl( const KURL & );
  78.     KURL uploadUrl() const;
  79.  
  80.     void setUseProgressManager( bool useProgressManager );
  81.     bool useProgressManager() const;
  82.  
  83.     void setUseCacheFile( bool useCacheFile );
  84.     bool useCacheFile() const;
  85.  
  86.     KABC::Lock *lock();
  87.  
  88.     bool isSaving();
  89.  
  90.     void dump() const;
  91.  
  92.     bool setValue( const QString &key, const QString &value );
  93.  
  94.  
  95.   protected slots:
  96.     void slotLoadJobResult( KIO::Job * );
  97.     void slotSaveJobResult( KIO::Job * );
  98.  
  99.     void slotPercent( KIO::Job *, unsigned long percent );
  100.  
  101.   protected:
  102.     bool doLoad();
  103.     bool doSave();
  104.  
  105.     void addInfoText( QString & ) const;
  106.  
  107.   private:
  108.     void init();
  109.  
  110.     KURL mDownloadUrl;
  111.     KURL mUploadUrl;
  112.  
  113.     bool mUseProgressManager;
  114.     bool mUseCacheFile;
  115.  
  116.     KIO::FileCopyJob *mDownloadJob;
  117.     KIO::FileCopyJob *mUploadJob;
  118.     
  119.     KPIM::ProgressItem *mProgress;
  120.  
  121.     Incidence::List mChangedIncidences;
  122.     
  123.     KABC::Lock *mLock;
  124.  
  125.     class Private;
  126.     Private *d;
  127. };
  128.  
  129. }
  130.  
  131. #endif
  132.